function SharedObjectHistory(soName) {
	this.name = soName;
	this.serverCalls = new Array();
}

/**
 * Adds a new object into the serverCalls array. The structure of the objects is as follows:
 * {funcName, parameters}
 */
SharedObjectHistory.prototype.addCall = function(funcName, parameters) {
	this.serverCalls.push({funcName:funcName, parameters:parameters});
}

/**
 * Returns the elements of the serverCalls array. If the funcName parameter is defined, it returns only the objects
 * with the value funcName in their funcName property. If the last parameter is set the function returns the last 'last' elements
 * of the serverCalls aray/
 */
SharedObjectHistory.prototype.getCalls = function(funcName, last) {
	// If user wants them all just give then.
	if(funcName == undefined && last == undefined) {
		return this.serverCalls;
	}
	// User wants only a filtered portion of the history.
	temp = new Array();
	// If last is undefined give them all.
	if(last == undefined) {
		for(i = 0; i < this.serverCalls.length; i++) {
			if(funcName == undefined || this.serverCalls[i].funcName == funcName) {
				temp.push(this.serverCalls[i]);
			}
		}
	} else {
		// Else start from the end and decrement last parameter for each match. Either array index reaches to the beginning
		// or the last parameter becomes zero.
		for(i = this.serverCalls.length; i >= 0 && last > 0; i--) {
			if(funcName == undefined || this.serverCalls[i].funcName == funcName) {
				temp.unshift(this.serverCalls[i]);
				last--;
			}
		}
	}
	return temp;
}